<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org">
<head>
    <th:block th:include="include :: header('修改认证源')"/>
    <th:block th:include="include :: ztree-css"/>
    <th:block th:include="include :: bootstrap-fileinput-css"/>
</head>
<body class="white-bg">
<div class="wrapper wrapper-content animated fadeInRight ibox-content">
    <form class="form-horizontal m" id="form-keystore-edit" th:object="${keystore}">
        <input id="keystoreId" name="keystoreId" type="hidden" th:field="*{keystoreId}"/>
        <div class="form-group">
            <label class="col-sm-3 control-label is-required">keystore名称：</label>
            <div class="col-sm-8">
                <input class="form-control" type="text" name="keystoreName" id="keystoreName" th:field="*{keystoreName}"
                       readonly required>
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-3 control-label">alg：</label>
            <div class="col-sm-8">
                <input class="form-control" type="text" name="alg" id="alg" th:field="*{alg}" required readonly>
            </div>
        </div>

        <div class="form-group">
            <label class="col-sm-3 control-label is-required">alias：</label>
            <div class="col-sm-8">
                <input class="form-control" type="text" name="alias" id="alias" th:field="*{alias}"
                       required readonly>
            </div>
        </div>

        <div class="form-group">
            <label class="col-sm-3 control-label is-required">cn：</label>
            <div class="col-sm-8">
                <input class="form-control" type="text" name="cn" id="cn" th:field="*{cn}"
                       required readonly>
                <span class="help-block m-b-none"><i class="fa fa-info-circle"></i> 名字与姓氏</span>
            </div>
        </div>

        <div class="form-group">
            <label class="col-sm-3 control-label is-required">ou：</label>
            <div class="col-sm-8">
                <input class="form-control" type="text" name="ou" id="ou" th:field="*{ou}"
                       required readonly>
                <span class="help-block m-b-none"><i class="fa fa-info-circle"></i> 组织单位名称</span>
            </div>
        </div>

        <div class="form-group">
            <label class="col-sm-3 control-label is-required">o：</label>
            <div class="col-sm-8">
                <input class="form-control" type="text" name="o" id="o" th:field="*{o}"
                       required readonly>
                <span class="help-block m-b-none"><i class="fa fa-info-circle"></i> 组织名称</span>
            </div>
        </div>

        <div class="form-group">
            <label class="col-sm-3 control-label is-required">l：</label>
            <div class="col-sm-8">
                <input class="form-control" type="text" name="l" id="l" th:field="*{l}"
                       required readonly>
                <span class="help-block m-b-none"><i class="fa fa-info-circle"></i> 城市或区域名称</span>
            </div>
        </div>

        <div class="form-group">
            <label class="col-sm-3 control-label is-required">st：</label>
            <div class="col-sm-8">
                <input class="form-control" type="text" name="st" id="st" th:field="*{st}"
                       required readonly>
                <span class="help-block m-b-none"><i class="fa fa-info-circle"></i> 省/市/自治区名称</span>
            </div>
        </div>

        <div class="form-group">
            <label class="col-sm-3 control-label is-required">c：</label>
            <div class="col-sm-8">
                <input class="form-control" type="text" name="c" id="c" th:field="*{c}"
                       required readonly>
                <span class="help-block m-b-none"><i class="fa fa-info-circle"></i> 国家/地区代码</span>
            </div>
        </div>

        <div class="form-group">
            <label class="col-sm-3 control-label is-required">keystorePass：</label>
            <div class="col-sm-8">
                <div class="input-group">
                    <input class="form-control" type="text" name="keystorePass" id="keystorePass"
                           th:field="*{keystorePass}" readonly>
                    <span class="input-group-addon" title="鼠标按下keystorePass"
                          onmousedown="$('#keystorePass').attr('type','text')"
                          onmouseup="$('#keystorePass').attr('type','password')"><i class="fa fa-key"></i></span>
                </div>
            </div>
        </div>

        <div class="form-group">
            <label class="col-sm-3 control-label is-required">privateKeyPass：</label>
            <div class="col-sm-8">
                <div class="input-group">
                    <input class="form-control" type="text" name="privateKeyPass" id="privateKeyPass"
                           th:field="*{privateKeyPass}" readonly>
                    <span class="input-group-addon" title="鼠标按下keystorePass"
                          onmousedown="$('#privateKeyPass').attr('type','text')"
                          onmouseup="$('#privateKeyPass').attr('type','password')"><i class="fa fa-key"></i></span>
                </div>
            </div>
        </div>

        <div class="form-group">
            <label class="col-sm-3 control-label is-required">显示顺序：</label>
            <div class="col-sm-8">
                <input class="form-control" type="text" name="sort" id="sort" th:field="*{sort}"
                       required>
            </div>
        </div>

        <div class="form-group">
            <label class="col-sm-3 control-label">备注：</label>
            <div class="col-sm-8">
                <input id="remark" name="remark" class="form-control" type="text" th:field="*{remark}">
            </div>
        </div>
    </form>
</div>
<th:block th:include="include :: footer"/>
<script type="text/javascript">
    var prefix = ctx + "system/keystore";

    // $("#keystorePass").prop("disabled", true)
    // $("#privateKeyPass").prop("disabled", true)

    $("#keystorePass").attr("type", 'password')
    $("#privateKeyPass").attr("type", 'password')

    $("#form-keystore-edit").validate({
        onkeyup: false,
        rules: {
            keystoreName: {
                remote: {
                    url: prefix + "/checkKeystoreNameUnique",
                    type: "post",
                    dataType: "json",
                    data: {
                        "keystoreId": function () {
                            return $("#keystoreId").val();
                        },
                        "keystoreName": function () {
                            return $.common.trim($("#keystoreName").val());
                        }
                    }
                }
            }
        },
        messages: {
            "keystoreName": {
                remote: "认证源名称已经存在"
            }
        },
        focusCleanup: true
    });

    function submitHandler() {
        if ($.validate.form()) {
            $.operate.save(prefix + "/edit", $('#form-keystore-edit').serialize());
        }
    }
</script>
</body>
</html>
